<template>
	<section>
		<!--工具条-->
		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
			<el-form :inline="true" :model="filters">

				<el-form-item label="省份" prop="province">
					<el-select v-model="filters.province" filterable :filter-method="selectfilter" placeholder="请选择省份">
						<el-option value="0" label="全部">全部</el-option>
						<el-option
								v-for="item in info"
								:key="item.provincename"
								:label="item.provincename"
								:value="item.provincename">
						</el-option>
					</el-select>
				</el-form-item>

				<el-form-item label="地市" prop="province">
					<el-select v-model="filters.city" filterable  placeholder="请选择地市">
						<el-option value="0" label="全部">全部</el-option>
						<el-option
								v-for="item in citys"
								:key="item.city"
								:label="item.city"
								:value="item.city">
						</el-option>
					</el-select>
				</el-form-item>

				<el-form-item>
					<el-input v-model="filters.dowonphonenum" placeholder="充值号码"></el-input>
				</el-form-item>

				<el-form-item>
					<el-input v-model="filters.productPrice" placeholder="产品金额"></el-input>
				</el-form-item>

				<el-form-item label="订单状态" prop="state">
					<el-select v-model="filters.status" placeholder="订单状态">
						<el-option value="0" label="全部">全部</el-option>
						<el-option value="2" label="充值成功">充值成功</el-option>
						<el-option value="3" label="充值失败">充值失败</el-option>
					</el-select>
				</el-form-item>

				<el-form-item>
					<el-date-picker type="datetime" placeholder="开始时间"  format="yyyy-MM-dd HH:mm:ss"   v-model="filters.createTime" style="width: 100%;"></el-date-picker>
				</el-form-item>
				<el-form-item>
					<el-date-picker type="datetime" placeholder="结束时间" format="yyyy-MM-dd HH:mm:ss"   v-model="filters.endtime" style="width: 100%;"></el-date-picker>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" v-on:click="findPageVirtualOrder">查询</el-button>
				</el-form-item>

				<!--<el-form-item>-->
					<!--<el-button type="primary" v-on:click="importBroadband">导入</el-button>-->
				<!--</el-form-item>-->

				<!--<el-form-item>-->
					<!--<el-button type="primary" v-on:click="exportBroadband">导出</el-button>-->
				<!--</el-form-item>-->

			</el-form>
		</el-col>
		<!--列表-->
		<template>
			<el-table :data="virtuals" highlight-current-row v-loading="loading" max-height="620"  @selection-change="selsChange" border  style="width: 100%;">
				<el-table-column  type="selection"  width="80" label="编号">
				</el-table-column>
				<el-table-column prop="downorderuuid" label="系统单号" width="170px" show-overflow-tooltip  >
				</el-table-column>
				<el-table-column prop="user.username" show-overflow-tooltip label="渠道商名称" show-overflow-tooltip >
				</el-table-column>
				<el-table-column prop="downreqid" label="下游单号" width="170px" show-overflow-tooltip  >
				</el-table-column>
				<el-table-column prop="productUuid" label="产品编码" width="170px" show-overflow-tooltip  >
				</el-table-column>
				<el-table-column prop="operators" label="运营商" show-overflow-tooltip   >
				</el-table-column>
				<el-table-column prop="province" label="省份" show-overflow-tooltip   >
				</el-table-column>
				<el-table-column prop="city" label="地市" show-overflow-tooltip   >
				</el-table-column>
				<el-table-column prop="dowonphonenum" label="手机号" show-overflow-tooltip   >
				</el-table-column>
				<el-table-column prop="state" label="订单状态"  width="100px" show-overflow-tooltip :formatter="formatState" >
				</el-table-column>
				<el-table-column prop="productPrice" label="产品金额"  width="130px" show-overflow-tooltip   >
				</el-table-column>
				<el-table-column prop="rechargeamount" label="充值金额"  width="130px" show-overflow-tooltip   >
				</el-table-column>
				<el-table-column prop="discount" label="产品折扣"  width="110px" show-overflow-tooltip   >
				</el-table-column>
				<el-table-column prop="discountAmount" label="扣款金额"  width="110px" show-overflow-tooltip   >
				</el-table-column>
				<el-table-column prop="createtime" label="充值时间" width="170px" show-overflow-tooltip   >
				</el-table-column>
				<el-table-column prop="downendtime" label="完成时间" width="170px" show-overflow-tooltip   >
				</el-table-column>
				<el-table-column prop="remark" label="备注" show-overflow-tooltip >
				</el-table-column>

				<!--<el-table-column label="操作"  fixed="right"   width="220">-->
					<!--<template scope="scope"   >-->
						<!--&lt;!&ndash;<el-button size="small"   @click="handleInTime(scope.$index, scope.row)">安装时间&ndash;&gt;-->
						<!--&lt;!&ndash;</el-button>&ndash;&gt;-->
						<!--&lt;!&ndash;<el-button size="small"   @click="handleEndTime(scope.$index, scope.row)">结束时间&ndash;&gt;-->
						<!--&lt;!&ndash;</el-button>&ndash;&gt;-->
						<!--<el-button size="small"   @click="handleEdit(scope.$index, scope.row)">-->
						<!--编辑-->
						<!--</el-button>-->
					<!--</template>-->
				<!--</el-table-column>-->
			</el-table>
		</template>
		<el-pagination
				@current-change="handleCurrentChange"
				@size-change="handleSizeChange"
				layout="total,sizes,prev, pager, next"
				:total="total">
		</el-pagination>

		<!--<el-dialog title="编辑宽带订单" v-model="editFormVisible" :close-on-click-modal="false">-->
			<!--<el-form :model="editForm" label-width="80px"  :inline="true":rules="editFormRules" ref="editForm">-->

				<!--<el-form-item label="商户" prop="shop">-->
					<!--<el-input v-model="editForm.shop" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="下游单号" prop="orderNum">-->
					<!--<el-input v-model="editForm.orderNum" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="下游渠道" prop="downShop">-->
					<!--<el-input v-model="editForm.downShop" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="下游产品编码" prop="downProduct">-->
					<!--<el-input v-model="editForm.downProduct" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="套餐名称" prop="productName">-->
					<!--<el-input v-model="editForm.productName" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="产品名称" prop="phone">-->
					<!--<el-input v-model="editForm.province" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="运营商" prop="operator">-->
					<!--<el-input v-model="editForm.operator" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="面值" prop="amount">-->
					<!--<el-input v-model="editForm.amount" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="用户实名" prop="name">-->
					<!--<el-input v-model="editForm.name" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="用户身份证" prop="idCard">-->
					<!--<el-input v-model="editForm.idCard" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="宽带账号" prop="broad">-->
					<!--<el-input v-model="editForm.broad" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="省份" prop="province">-->
					<!--<el-input v-model="editForm.province" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->

				<!--<el-form-item label="地市" prop="city">-->
					<!--<el-input v-model="editForm.city" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="联系方式" prop="contact">-->
					<!--<el-input v-model="editForm.contact" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="用户留言" prop="userMsg">-->
					<!--<el-input v-model="editForm.userMsg" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="商家备注" prop="shopRemark">-->
					<!--<el-input v-model="editForm.shopRemark" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="收货人" prop="consignee">-->
					<!--<el-input v-model="editForm.consignee" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="收货地址" prop="address">-->
					<!--<el-input v-model="editForm.address" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="收货号码" prop="phone">-->
					<!--<el-input v-model="editForm.province" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="创建时间" prop="createTime">-->
					<!--<el-input v-model="editForm.createTime" auto-complete="off"></el-input>-->
				<!--</el-form-item>-->

				<!--<el-form-item label="订单状态" prop="state">-->
					<!--<el-select v-model="editForm.state" placeholder="订单状态">-->
						<!--<el-option value="1" label="成功">成功</el-option>-->
						<!--<el-option value="2" label="初始化">初始化</el-option>-->
						<!--<el-option value="3" label="等待">等待</el-option>-->
						<!--<el-option value="4" label="处理中">处理中</el-option>-->
						<!--<el-option value="5" label="失败">失败</el-option>-->
					<!--</el-select>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="退款状态" prop="refund">-->
					<!--<el-select v-model="editForm.refund" placeholder="退款状态">-->
						<!--<el-option value="1" label="成功">成功</el-option>-->
						<!--<el-option value="2" label="等待确认">等待确认</el-option>-->
						<!--<el-option value="3" label="等待退款">等待退款</el-option>-->
						<!--<el-option value="4" label="退款中">退款中</el-option>-->
						<!--<el-option value="5" label="失败">失败</el-option>-->
					<!--</el-select>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="通知状态" prop="notifiy">-->
					<!--<el-select v-model="editForm.notifiy" placeholder="通知状态">-->
						<!--<el-option value="1" label="成功">成功</el-option>-->
						<!--<el-option value="2" label="无需">无需</el-option>-->
						<!--<el-option value="3" label="等待">等待</el-option>-->
						<!--<el-option value="4" label="退款中">处理中</el-option>-->
						<!--<el-option value="5" label="失败">失败</el-option>-->
					<!--</el-select>-->
				<!--</el-form-item>-->

				<!--<el-form-item label="备注">-->
					<!--<el-input type="textarea" v-model="editForm.errorMsg"></el-input>-->
				<!--</el-form-item>-->
			<!--</el-form>-->
			<!--<div slot="footer" class="dialog-footer">-->
				<!--<el-button @click.native="editFormVisible = false">取消</el-button>-->
				<!--<el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button>-->
			<!--</div>-->
		<!--</el-dialog>-->

		<!--<el-dialog title="批量分配宽带订单" v-model="distributionFormVisible" :close-on-click-modal="false">-->
			<!--<el-form :model="distributionForm" label-width="80px"  :inline="true":rules="distributionFormRules" ref="editForm">-->

				<!--<el-form-item label="宽带渠道" prop="useruuid"  v-show="isShowSupper">-->
					<!--<el-select v-model="distributionForm.useruuid" filterable  placeholder="请选择分配宽带渠道" >-->
						<!--<el-option value="0" label="全部">全部</el-option>-->
						<!--<el-option-->
								<!--v-for="item in users"-->
								<!--:key="item.useruuid"-->
								<!--:label="item.username"-->
								<!--:value="item.useruuid">-->
						<!--</el-option>-->
					<!--</el-select>-->
				<!--</el-form-item>-->
				<!--&lt;!&ndash;<el-form-item label="备注">&ndash;&gt;-->
					<!--&lt;!&ndash;<el-input type="textarea" v-model="distribution.errorMsg"></el-input>&ndash;&gt;-->
				<!--&lt;!&ndash;</el-form-item>&ndash;&gt;-->
			<!--</el-form>-->
			<!--<div slot="footer" class="dialog-footer">-->
				<!--<el-button @click.native="distributionFormVisible = false">取消</el-button>-->
				<!--<el-button type="primary" @click.native="distributionSubmit" :loading="distributionLoading">提交</el-button>-->
			<!--</div>-->
		<!--</el-dialog>-->


		<!--<el-dialog title="批量修改通知状态" v-model="notifiyFormVisible" :close-on-click-modal="false">-->
			<!--<el-form :model="notifiyForm" label-width="80px"  :inline="true":rules="notifiyFormRules" ref="editForm">-->

				<!--<el-form-item label="通知状态" prop="notifiy">-->
					<!--<el-select v-model="notifiyForm.notifiy" placeholder="通知状态">-->
						<!--<el-option value="1" label="成功">成功</el-option>-->
						<!--<el-option value="2" label="无需">无需</el-option>-->
						<!--<el-option value="3" label="等待">等待</el-option>-->
						<!--<el-option value="4" label="退款中">处理中</el-option>-->
						<!--<el-option value="5" label="失败">失败</el-option>-->
					<!--</el-select>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="备注">-->
					<!--<el-input type="textarea" v-model="notifiyForm.errorMsg"></el-input>-->
				<!--</el-form-item>-->
			<!--</el-form>-->
			<!--<div slot="footer" class="dialog-footer">-->
				<!--<el-button @click.native="notifiyFormVisible = false">取消</el-button>-->
				<!--<el-button type="primary" @click.native="notifiySubmit" :loading="notifiyFormLoading">提交</el-button>-->
			<!--</div>-->
		<!--</el-dialog>-->

		<!--<el-dialog title="批量修改订单状态" v-model="stateFormVisible" :close-on-click-modal="false">-->
			<!--<el-form :model="stateForm" label-width="80px"  :inline="true":rules="stateFormRules" ref="editForm">-->

				<!--<el-form-item label="订单状态" prop="state">-->
					<!--<el-select v-model="stateForm.state" placeholder="订单状态">-->
						<!--<el-option value="0" label="全部">全部</el-option>-->
						<!--<el-option value="1" label="成功">成功</el-option>-->
						<!--<el-option value="2" label="初始化">初始化</el-option>-->
						<!--<el-option value="3" label="等待">等待</el-option>-->
						<!--<el-option value="4" label="处理中">处理中</el-option>-->
						<!--<el-option value="5" label="失败">失败</el-option>-->
					<!--</el-select>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="备注">-->
					<!--<el-input type="textarea" v-model="stateForm.errorMsg"></el-input>-->
				<!--</el-form-item>-->
			<!--</el-form>-->
			<!--<div slot="footer" class="dialog-footer">-->
				<!--<el-button @click.native="stateFormVisible = false">取消</el-button>-->
				<!--<el-button type="primary" @click.native="stateFormSubmit" :loading="stateFormLoading">提交</el-button>-->
			<!--</div>-->
		<!--</el-dialog>-->

		<!--<el-dialog title="批量修改退款状态" v-model="refundFormVisible" :close-on-click-modal="false">-->
			<!--<el-form :model="refundForm" label-width="80px"  :inline="true":rules="refundFormRules" ref="editForm">-->

				<!--<el-form-item label="退款状态" prop="refund">-->
					<!--<el-select v-model="refundForm.refund" placeholder="退款状态">-->
						<!--<el-option value="0" label="全部">全部</el-option>-->
						<!--<el-option value="1" label="成功">成功</el-option>-->
						<!--<el-option value="2" label="等待确认">等待确认</el-option>-->
						<!--<el-option value="3" label="等待退款">等待退款</el-option>-->
						<!--<el-option value="4" label="退款中">退款中</el-option>-->
						<!--<el-option value="5" label="失败">失败</el-option>-->
					<!--</el-select>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="备注">-->
					<!--<el-input type="textarea" v-model="refundForm.errorMsg"></el-input>-->
				<!--</el-form-item>-->
			<!--</el-form>-->
			<!--<div slot="footer" class="dialog-footer">-->
				<!--<el-button @click.native="refundFormVisible = false">取消</el-button>-->
				<!--<el-button type="primary" @click.native="refundFormSubmit" :loading="refundFormLoading">提交</el-button>-->
			<!--</div>-->
		<!--</el-dialog>-->

		<!--<el-dialog title="导入订单" v-model="importFormVisible" :close-on-click-modal="false">-->
			<!--<el-form :model="importForm" label-width="80px"  :inline="true":rules="importFormRules"  ref="broadband">-->
				<!--&lt;!&ndash;http://119.23.127.152:8283/weiliu/virtual/importVirtualOrder&ndash;&gt;-->
				<!--<el-form-item label="选择文件">-->
					<!--<el-upload-->
							<!--ref="importBroadbandUpload"-->
							<!--action="http://119.23.127.152:8283/weiliu/virtual/importVirtualOrder"-->
							<!--:limit="1"-->
							<!--multiple-->
							<!--:file-list="fileList"-->
							<!--:beforeUpload="beforeAvatarUpload"-->
							<!--:on-exceed="handleExceed"-->
							<!--:on-success="handleSuccess"-->
							<!--:on-preview="handlePictureCardPreview"-->
							<!--:auto-upload="false"-->
							<!--:on-remove="handleRemove">-->
						<!--<el-button slot="trigger" size="small" type="primary">选择文件</el-button>-->
						<!--<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>-->
						<!--<div slot="tip" class="el-upload__tip">只能上传excel文件,并且单次只能上传一个文件</div>-->
					<!--</el-upload>-->

				<!--</el-form-item>-->

			<!--</el-form>-->
			<!--<div slot="footer" class="dialog-footer">-->
				<!--<el-button @click.native="importFormVisible=false">取消</el-button>-->

				<!--&lt;!&ndash;<el-button type="primary" @click.native="importFormSubmit" :loading="importFormLoading">提交</el-button>&ndash;&gt;-->
			<!--</div>-->
		<!--</el-dialog>-->
	</section>

</template>
<script>
	import { findPageVirtualOrder ,findAllPro,findProvinceCity} from '../../api/api';
	//import NProgress from 'nprogress'
    import moment from 'moment';
    var crypto = require('crypto');
	export default {
		data() {
			return {
				filters: {
                    createTime:  moment(new Date(),"YYYY-MM-DD HH:mm:ss").format('YYYY-MM-DD') + " 00:00:00",
                    endtime:'',
                    province:'',
                    productPrice:'',
                    status:'',
                    dowonphonenum:'',
                    city:''

				},
                fileList: [],
                isShowSupper:JSON.parse(sessionStorage.getItem("user")).usertype === 2 ? true : false,
				start:0,
				pageSize:10,
                total:0,
				loading: false,
				users: [],
                info:[],
                citys:[],
                virtuals:[],
                sels:[],
                editFormVisible: false,//新增界面是否显示
                editLoading: false,
                editFormRules: {

                },
                //新增界面数据
                editForm: {
                    createTime: '',
                    endtime:'',
                    orderNum:'',
                    downShop:'',
                    downProduct:'',
                    province:'',
                    consignee:'',
                    notifiy:'',
                    refund:'',
                    state:'',
                    amount:'',
                    useruuid:'',
                    shopRemark:'',
                    contact:''
                },

                distributionFormVisible: false,
                distributionLoading: false,
                distributionFormRules: {
                },
                distributionForm: {
                    createTime: '',
                    endtime:'',
                    orderNum:'',
                    downShop:'',
                    downProduct:'',
                    province:'',
                    consignee:'',
                    notifiy:'',
                    refund:'',
                    state:'',
                    amount:'',
                    useruuid:'',
                    shopRemark:'',
                    contact:''
                },

                notifiyFormVisible: false,
                notifiyFormLoading: false,
                notifiyFormRules: {
                },
                notifiyForm: {
                    createTime: '',
                    endtime:'',
                    orderNum:'',
                    downShop:'',
                    downProduct:'',
                    province:'',
                    consignee:'',
                    notifiy:'',
                    refund:'',
                    state:'',
                    amount:'',
                    useruuid:'',
                    shopRemark:'',
                    errorMsg:'',
                    contact:''
                },

                stateFormVisible: false,
                stateFormLoading: false,
                stateFormRules: {
                },
                stateForm: {
                    createTime: '',
                    endtime:'',
                    orderNum:'',
                    downShop:'',
                    downProduct:'',
                    province:'',
                    consignee:'',
                    notifiy:'',
                    refund:'',
                    state:'',
                    errorMsg:'',
                    amount:'',
                    useruuid:'',
                    shopRemark:'',
                    contact:''
                },

                refundFormVisible: false,
                refundFormLoading: false,
                refundFormRules: {
                },
                refundForm: {
                    createTime: '',
                    endtime:'',
                    orderNum:'',
                    downShop:'',
                    downProduct:'',
                    errorMsg:'',
                    province:'',
                    consignee:'',
                    notifiy:'',
                    refund:'',
                    state:'',
                    amount:'',
                    useruuid:'',
                    shopRemark:'',
                    contact:''
                },
                importFormVisible: false,
                importFormLoading: false,
                importFormRules: {
				},
                importForm: {
					createTime: '',
						endtime:'',
						orderNum:'',
						downShop:'',
						downProduct:'',
						errorMsg:'',
						province:'',
						consignee:'',
						notifiy:'',
						refund:'',
						state:'',
						amount:'',
						useruuid:'',
						shopRemark:'',
						contact:''
				},
			}
		},
		methods: {

            formatRefund: function (row, column) {
                //1 管理员 2超级管理员 3 下游渠道商
				return row.refund == 1 ? '成功' : row.refund == 2 ? '等待确认' : row.refund == 3 ? '等待退款':  row.refund == 4 ? "退款中" : row.refund == 5 ? "失败" : "供货商";
			},

            formatState: function (row, column) {
//                状态 0 删除 1 充值中 2 充值成功 3充值失败  4成功后取消的订单  5 订单达到  6退款成功 7 退款失败
                return row.status == 1 ? '充值中' : row.status == 2 ? ' 充值成功 ' :  row.status == 3 ? '充值失败' : "未知";
            },
            formatNotifiy:function(row, column){
                return row.notifiy === 1 ? '成功' : row.notifiy === 2 ? '无需' : row.notifiy === 3 ? "等待" : row.notifiy === 4 ? "处理中" :   row.notifiy === 4 ? "失败" : "其他";
			},
            handleAdd:function(){
				this.addFormVisible = true;
			},

            findPageVirtualOrder: function () {
				let para = {
					start:this.start,
					pageSize:this.pageSize,
                    createTime:  moment(this.filters.createTime,"YYYY-MM-DD HH:mm:ss").format('YYYY-MM-DD HH:mm:ss'),
                    endtime:this.filters.endtime == "" ? "" :  moment(this.filters.endtime,"YYYY-MM-DD HH:mm:ss").format('YYYY-MM-DD HH:mm:ss'),
                    province: this.filters.province == "0" ? "" :this.filters.province,
                    status:this.filters.status == "0" ? "" : this.filters.status,
                    dowonphonenum:this.filters.dowonphonenum,
                    productPrice:this.filters.productPrice,
                    city : this.filters.province == "0" ? "" : this.filters.city == "0" ? "" : this.filters.city
				};
				this.loading = true;
                findPageVirtualOrder(para).then(datas => {
                    this.loading = false;
                    let { message, code, data } = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else {
                        this.virtuals = data.result;
                        this.total = data.totalCount;
                    }
                }).catch(e =>{

				});
			},handleCurrentChange:function(val){
                this.start = val - 1;
                this.findPageVirtualOrder();
			},
            handleSizeChange:function(val){
			    this.pageSize = val;
			    this.findPageVirtualOrder();
			},
            updateBroadbands: function (index, row) {
                if(this.sels.length > 0){
                    this.distributionFormVisible = true;
				}else{
                    this.$message({
                        message: '请选择订单',
                        type: 'error'
                    });
				}
            },handleEdit:function(index, row){
                this.editFormVisible = true;
                this.editForm = Object.assign({}, row);
                this.editForm.notifiy = row.notifiy+"";
                this.editForm.refund = row.refund+"";
                this.editForm.state = row.state+"";
			},handleInTime:function (index, row) {
                let para = Object.assign({}, row);
                para.inTime = "";
                this.$confirm('确认更新该订单安装时间信息吗?以系统当前时间为准!', '提示', {
                    type: 'warning'
                }).then(() => {
                    this.editFormVisible = true;
                    updateInTime(para).then((res) => {
                        this.editFormVisible = false;
                        //NProgress.done();
                        this.$message({
                            message: '操作成功',
                            type: 'success'
                        });
                        this.findPageVirtualOrder();
                    });
                });
            },handleEndTime:function (index, row) {
                let para = Object.assign({}, row);
                para.inTime = "";
                this.$confirm('确认更新该订单结束时间信息吗?以系统当前时间为准!', '提示', {
                    type: 'warning'
                }).then(() => {
                    this.editFormVisible = true;
                    updateEndTime(para).then((res) => {
                        this.editFormVisible = false;
                        //NProgress.done();
                        this.$message({
                            message: '操作成功',
                            type: 'success'
                        });
                        this.findPageVirtualOrder();
                    });
                });
        	}
			,editSubmit(){
                let para = Object.assign({}, this.editForm);
                para.useruuid = JSON.parse(sessionStorage.getItem("user")).useruuid;
                this.$confirm('确认编辑该订单信息吗?', '提示', {
                    type: 'warning'
                }).then(() => {
                    this.editFormVisible = true;
                    updateBroadband(para).then((res) => {
                        this.editFormVisible = false;
                        //NProgress.done();
                        this.$message({
                            message: '操作成功',
                            type: 'success'
                        });
                        this.findPageVirtualOrder();
                    });
                }).catch(() => {

                });
            } ,selsChange: function (sels) {
                this.sels = sels;
            },states:function(){
                if(this.sels.length > 0){
                    this.stateFormVisible = true;
                }else{
                    this.$message({
                        message: '请选择订单',
                        type: 'error'
                    });
                }
			},refunds:function(){
                if(this.sels.length > 0){
                    this.refundFormVisible = true;
                }else{
                    this.$message({
                        message: '请选择订单',
                        type: 'error'
                    });
                }
            },notifiys:function(){
                if(this.sels.length > 0){
                     this.notifiyFormVisible = true;
                }else{
                    this.$message({
                        message: '请选择订单',
                        type: 'error'
                    });
                }
            },notifiySubmit:function () {
                this.$confirm('确认操作批量通知吗?', '提示', {
                    type: 'warning'
                }).then(() => {
                    let para = {
                        useruuids: this.sels,
                        notifiy:this.notifiyForm.notifiy,
                        errorMsg:this.notifiyForm.errorMsg
                    };
                    updateNotifiys(para).then((res) => {
                        this.notifiyFormVisible = false;
                        //NProgress.done();
                        let { message, code, data } = res;
                        if (code !== "0") {
                            this.$message({
                                message: message,
                                type: 'error'
                            });
                        } else {
                            this.$message({
                                message: '操作成功',
                                type: 'success'
                            });
                        }
                        this.findPageVirtualOrder();
                    });
                });
            },distributionSubmit:function () {
                this.$confirm('确认操作批量分配吗?', '提示', {
                    type: 'warning'
                }).then(() => {
                    let para = {
                        useruuids: this.sels,
                        useruuid:this.distributionForm.useruuid
                    };
                    updateBroadbands(para).then((res) => {
                        this.distributionFormVisible = false;
                        //NProgress.done();
                        let { message, code, data } = res;
                        if (code !== "0") {
                            this.$message({
                                message: message,
                                type: 'error'
                            });
                        } else {
                            this.$message({
                                message: '操作成功',
                                type: 'success'
                            });
                        }
                        this.findPageVirtualOrder();
                    });
                });
            },stateFormSubmit:function () {
                this.$confirm('确认操作批量修改订单状态吗?', '提示', {
                    type: 'warning'
                }).then(() => {
                    let para = {
                        useruuids: this.sels,
                        state:this.stateForm.state,
                        errorMsg:this.stateForm.errorMsg
                    };
                    updateStates(para).then((res) => {
                        this.stateFormVisible = false;
                        //NProgress.done();
                        let { message, code, data } = res;
                        if (code !== "0") {
                            this.$message({
                                message: message,
                                type: 'error'
                            });
                        } else {
                            this.$message({
                                message: '操作成功',
                                type: 'success'
                            });
                        }
                        this.findPageVirtualOrder();
                    });
                });
            },refundFormSubmit:function () {
                this.$confirm('确认操作批量退款吗?', '提示', {
                    type: 'warning'
                }).then(() => {
                        let para = {
                            useruuids: this.sels,
                            refund:this.refundForm.refund,
                            errorMsg:this.refundForm.errorMsg
                        };
						updateRefunds(para).then((res) => {
							this.refundFormVisible = false;
							//NProgress.done();
							let { message, code, data } = res;
							if (code !== "0") {
								this.$message({
									message: message,
									type: 'error'
								});
							} else {
								this.$message({
									message: '操作成功',
									type: 'success'
								});
							}
							this.findPageBroadband();
						});
                });
            },importBroadband:function () {
                this.importFormVisible = true;
            },exportBroadband:function () {
                let para = {
                    createTime:  moment(this.filters.createTime,"YYYY-MM-DD HH:mm:ss").format('YYYY-MM-DD HH:mm:ss'),
                    endtime:this.filters.endtime == "" ? "" :  moment(this.filters.endtime,"YYYY-MM-DD HH:mm:ss").format('YYYY-MM-DD HH:mm:ss'),
                    orderNum:this.filters.orderNum,
                    downShop:this.filters.downShop,
                    downProduct:this.filters.downProduct,
                    province:this.filters.province == "0" ? "" : this.filters.province,
                    consignee:this.filters.consignee,
                    amount:this.filters.amount,
                    notifiy:this.filters.notifiy == "0" ? "" : this.filters.notifiy,
                    refund:this.filters.refund == "0" ? "" : this.filters.refund,
                    state:this.filters.state == "0" ? "" : this.filters.state,
                    useruuid:this.filters.useruuid == "0" ? "": this.filters.useruuid,
                    shopRemark:this.filters.shopRemark,
                    contact:this.filters.contact,
                    city : this.filters.province == "0" ? "" : this.filters.city == "0" ? "" : this.filters.city
                };
                this.loading = true;
                exportBroadband(para).then(datas => {
                    let {message, code, data} = datas;
                    this.loading = false;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else {
                        window.open(data.path);
                    }
                }).catch(e =>{
                    this.loading = false;
                });
            },importFormSubmit:function () {

            },handleRemove:function(file, fileList) {
                console.log(file, fileList);
            },
            handlePreview:function(file) {
                console.log(file);
            },
            handleExceed:function(files, fileList) {
                if(fileList.length > 1){
                    this.$message.warning(`当前限制选择 1 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
				}

            },
            beforeRemove:function(file, fileList) {
                return this.$confirm(`确定移除 ${ file.name }？`);
            },handlePictureCardPreview:function(file){
                console.log(file);
			},handleSuccess:function(response, file, fileList){
                console.log(file);
                this.importFormVisible = false;
                this.findPageBroadband();
                if(response.code == "0"){
                    this.$message({
                        message: response.message,
                        type: 'info'
                    });
				}else{
                    this.$message({
                        message: response.message,
                        type: 'warning'
                    });
				}
			},submitUpload(){
                this.$refs.importBroadbandUpload.submit();
			},beforeAvatarUpload(file){
                var testmsg=file.name.substring(file.name.lastIndexOf('.')+1)
                const extension = testmsg === 'xls';
                const extension2 = testmsg === 'xlsx';
//                const isLt2M = file.size / 1024 / 1024 < 10;
                if(!extension && !extension2) {
                    this.$message({
                        message: '上传文件只能是 xls、xlsx格式!',
                        type: 'warning'
                    });
                }

                return extension || extension2 ;
			},batchDeletes:function(){
                if(this.sels.length > 0){
                    this.$confirm('确认操作批量删除吗?', '提示', {
                        type: 'warning'
                    }).then(() => {
                        let para = {
                            broadbandIds: this.sels
                        };
                        deleteBroadband(para).then((res) => {
                            //NProgress.done();
                            let { message, code, data } = res;
                            if (code !== "0") {
                                this.$message({
                                    message: message,
                                    type: 'error'
                                });
                            } else {
                                this.$message({
                                    message: '操作成功',
                                    type: 'success'
                                });
                            }
                            this.findPageVirtualOrder();
                        });
                    });
                }else{
                    this.$message({
                        message: '请选择订单',
                        type: 'error'
                    });
                }
			},
            findAllPro:function(){
                let para = {useruuid: ''};
                findAllPro(para).then(datas => {
                    let {message, code, data} = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else {
                        this.info = data;
                    }
                });
            },
            selectfilter:function(row){
                if(row != ""){
                    this.findProvinceCity(row)
                }
            },findProvinceCity:function (province) {
                let para = {
                    province : province
                };
                findProvinceCity(para).then((datas) => {
                    let { message, code, data } = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    }
                    this.citys = data;
                });
            }
		},

		mounted() {
		    this.findAllPro();
			this.findPageVirtualOrder();
		},
    	beforeCreate: function (){
//            window.location.reload();
		}
	};

</script>

<style scoped>

</style>
